#!/usr/bin/python
# -*- coding: utf-8 -*-
import time
from config.config import config
import tushare as ts

ts.set_token(config.get('tushare', 'token'))
pro = ts.pro_api()


def daily_data(ts_code, start_date="20050101", end_date=time.strftime('%Y%m%d')):
    # df = pro.day(ts_code='000001.SZ', start_date='20180701', end_date='20180718')
    df = pro.daily(ts_code=ts_code, start_date=start_date, end_date=end_date)
    return df


def trade_cal(start_date='20050101', end_date=time.strftime('%Y%m%d')):
    df = pro.trade_cal(exchange='', start_date=start_date, end_date=end_date)
    return df


def acquire_stock_list():
    """
    询当前所有正常上市交易的股票列表
    :return:
    """
    df = pro.stock_basic(exchange='', list_status='L', fields='ts_code,symbol,name,area,industry,list_date')
    return df


if __name__ == "__main__":
    df = trade_cal()
    print(df)
